package com.company.clientscard.main.widgets.general;

import com.company.clientscard.shared.proxyManager.ProxyManager;
import com.google.gwt.view.client.HasData;

public class TableManager<T> {

	private TableDataProvider<T> aDataProvider;

	private HasData<T> display;
	private ProxyManager<T> manager;

	public TableManager(ProxyManager<T> manager) {
		this.manager = manager;
		aDataProvider = new TableDataProvider<T>(manager);
	}

	public void addDataDisplay(HasData<T> display) {
		this.display = display;
		aDataProvider.addDataDisplay(display);
	}

	public void refreshDisplays() {
		display.setVisibleRangeAndClearData(display.getVisibleRange(), true);
	}

	public TableDataProvider<T> getTableDataProvider() {
		return aDataProvider;
	}

	public HasData<T> getDisplay() {
		return display;
	}

	public ProxyManager<T> getManager() {
		return manager;
	}
}
